﻿<aside class="col-lg-3 d-none d-lg-block">
    @if (BlogConfig.GeneralSettings.WidgetsProfile)
    {
        <section class="blog-info-desktop-lg text-light d-none d-lg-block">
            <div class="card-bkimg-container">
                <img class="card-bkimg" alt="" src="@BlogConfig.GeneralSettings.AvatarUrl" />
            </div>
            <div class="blog-info-photo-text text-center">
                <img src="@BlogConfig.GeneralSettings.AvatarUrl"
                 alt="@BlogConfig.GeneralSettings.OwnerName"
                 class="rounded-circle blogger-head-pic" />
                <div>
                    <h3 class="mt-3 text-white font-sairas">
                        @BlogConfig.GeneralSettings.OwnerName
                    </h3>
                    <p class="me-3 ms-3">
                        @BlogConfig.GeneralSettings.Description
                    </p>
                </div>
            </div>
        </section>
    }

    @if (!string.IsNullOrWhiteSpace(BlogConfig.GeneralSettings.SideBarCustomizedHtmlPitch))
    {
        @Html.Raw(BlogConfig.GeneralSettings.SideBarCustomizedHtmlPitch)
    }

    @if (BlogConfig.GeneralSettings.WidgetsTags)
    {
        <section id="aside-tags" class="mt-4 mb-4">
            <div class="card">
                <div class="card-header">@SharedLocalizer["Tags"]</div>
                <div class="card-body">
                    <cache expires-after="@TimeSpan.FromMinutes(60)">
                        @await Component.InvokeAsync("Tags")
                    </cache>
                    <hr />
                    <a asp-page="/Tags" class="card-link">
                        <i class="bi-tag me-1"></i>
                        @SharedLocalizer["All Tags"]
                    </a>
                </div>
            </div>
        </section>
    }

    @if (BlogConfig.GeneralSettings.WidgetsCategoryList)
    {
        <section id="aside-cats" class="mb-4">
            <div class="card">
                <div class="card-header">@SharedLocalizer["Categories"]</div>
                @await Component.InvokeAsync("CategoryList", new { isMenu = false })
            </div>
        </section>
    }

    @if (BlogConfig.GeneralSettings.WidgetsFriendLink)
    {
        <section id="aside-friendlink" class="mb-4">
            <cache expires-after="@TimeSpan.FromMinutes(60)">
                @await Component.InvokeAsync("FriendLink")
            </cache>
        </section>
    }

    @if (BlogConfig.GeneralSettings.WidgetsSubscriptionButtons)
    {
        <section id="aside-subscription" class="text-center mb-4">
            <a class="btn btn-sm btn-round btn-outline-secondary me-2" href="#" data-bs-toggle="modal" data-bs-target="#subscriptionmodal">
                <i class="bi-rss"></i>
                RSS / Atom
            </a>
            
            @if (BlogConfig.AdvancedSettings.EnableOpml)
            {
                <a asp-controller="Subscription" asp-action="Opml" class="btn btn-sm btn-round btn-outline-secondary" target="_blank">
                    <i class="bi-code-slash"></i>
                    OPML
                </a>
            }
        </section>
    }

    @if (BlogConfig.GeneralSettings.ShowAdminLoginButton)
    {
        <div class="text-center">
            <a href="/admin" class="btn btn-sm btn-light">@SharedLocalizer["Admin Login"]</a>
        </div>
    }
</aside>

@if (BlogConfig.GeneralSettings.WidgetsSubscriptionButtons)
{
    <div class="modal fade" id="subscriptionmodal" tabindex="-1" role="dialog" aria-labelledby="subscriptionmodalLabel" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h6 class="modal-title" id="subscriptionmodalLabel">RSS / Atom Feed</h6>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <div class="row mb-4">
                        <div class="col-6">
                            <a asp-controller="Subscription" asp-action="rss" class="btn w-100 btn-outline-success">
                                @SharedLocalizer["Latest Posts"] (RSS)
                            </a>
                        </div>
                        <div class="col-6">
                            <a asp-controller="Subscription" asp-action="Atom" class="btn w-100 btn-outline-success">
                                @SharedLocalizer["Latest Posts"] (Atom)
                            </a>
                        </div>
                    </div>
                    <div class="row">
                        @await Component.InvokeAsync("RssList")
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">@SharedLocalizer["Close"]</button>
                </div>
            </div>
        </div>
    </div>
}
